package com.sunny;

public class Demo1 {

    public static void main(String[] args) {

        Demo1 demo1 = new Demo1();
        new Thread(()->{
            demo1.a();
        }).start();
        new Thread(()->{
            demo1.b();
        }).start();

        new Thread(()->{
            Demo1.c();
        }).start();

    }

    public synchronized void a(){
        System.out.println("a start");
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("a finish");

    }

    public synchronized void b(){
        System.out.println("b start");
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("b finish");

    }

    public synchronized static void c(){
        System.out.println("c start");
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("c finish");
    }

}
